function setLine(id, data, callback) {
	var myChart = echarts.init(document.getElementById(id));

	var data1 = [];
	var data2 = [];

	for (var i = 0; i < 24; i++) {
		data2.push(i + ":00");
		data1.push(getRandom(50, 254));
	}

	option = {
		xAxis: {
			type: 'category',
			splitNumber: 2,
			scale: true,
			splitLine: {
				show: false //去掉网格线
			},
			data: data2,
			axisLabel: {
				show: true,
				textStyle: {
					color: '#999999'
				}
			}
		},
		yAxis: {
			type: 'value',
			splitNumber: 2,
			//scale:true,
			splitLine: {
				show: false //去掉网格线
			},
			axisLabel: {
				formatter: '{value}',
				textStyle: {
					color: '#999999'
				}
			}
		},
		grid: {
			top: 30,
			left: 35, // 调整这个属性
			right: 10,
			bottom: 30,
		},
		series: [{
			data: data1,
			type: 'line',
			symbol: 'circle', //折线点设置为实心点
			symbolSize: 5, //折线点的大小
			areaStyle: {
				normal: {
					color: '#323F4F' //改变区域颜色
				}
			},
			itemStyle: {
				normal: {
					color: "#262B32", //折线点的颜色
					borderColor: '#386db3',
					borderWidth: 2,
					lineStyle: {
						color: "#386db3" //折线的颜色
					}
				}
			},
		}]
	};

	myChart.setOption(option);
	myChart.on('click', callback);

}



function setLine2(id, data, callback) {
	var chat3 = echarts.init(document.getElementById(id));

	var data1 = [];
	var data2 = [];


	for (var i = 0; i < 24; i++) {
		//data1.push(i * 5);
		data2.push(getRandom(70, 125));
		data1.push(i + ":00");
	}

	option = {
		xAxis: {
			type: 'category',
			scale: true,
			splitLine: {
				show: false //去掉网格线
			},
			data: data1,
			axisLabel: {
				show: true,
				textStyle: {
					color: '#999999'
				}
			}
		},
		yAxis: {
			type: 'value',
			splitNumber: 2,
			//scale:true,
			splitLine: {
				show: false //去掉网格线
			},
			axisLabel: {
				formatter: '{value}',
				textStyle: {
					color: '#999999'
				}
			}
		},
		grid: {
			top: 30,
			left: 35, // 调整这个属性
			right: 10,
			bottom: 30,
		},
		series: [{
			data: data2,
			type: 'line',
			symbol: 'none', //折线点设置为实心点
			itemStyle: {
				normal: {
					color: "#D65053", //折线点的颜色
					lineStyle: {
						color: "#D65053", //折线的颜色
						show: true,
						shadowColor: 'rgba(214, 80, 85, 0.9)',
						shadowBlur: 8
					},
				},
			},
		}]
	};

	chat3.setOption(option);
	chat3.on('click', callback);
}




//仪表盘
function setDashboard(id, data,unit) {
	var chart = echarts.init(document.getElementById(id));
	unit = unit || "%";

	var colorTemplate1 = [
		[1, "#189BFE"]
	];


	var option = {
		tooltip: {
			show: false
		},
		series: [{
				name: '最外层',
				type: 'gauge',
				radius: '85%',
				center: ['50%', '50%'],
				startAngle: 220,
				endAngle: -40,
				axisLine: {
					show: false,
				},
				splitNumber: 5, //刻度数量
				splitLine: {
					length: 3,
					splitNumber: 5,
					lineStyle: {
						color: '#999999',
						width: 1
					}
				},

				axisLabel: { //大刻度标签。
					distance: -10, //数字刻度距离
					splitNumber: 5,
					textStyle: { //数字刻度样式
						color: '#999999',
						fontSize: 12,
					},
					formatter: function(param) {
						if (param % 20 == 0 && param != 0 && param != 100) {
							return param
						}
					}
				},

				axisTick: {
					show: false
				},
				detail: {
					show: false
				},
				pointer: {
					show: false
				}

			},



			{
				name: '第二根线',
				type: 'gauge',
				background: "#000",
				radius: '72%',
				center: ['50%', '50%'],
				startAngle: 220,
				endAngle: -40,
				axisLine: {
					lineStyle: {
						width: 1,
						color: [
							[1, '#00ECEC']
						]
					}
				},
				splitLine: {
					show: false
				},
				axisLabel: {
					show: false
				},
				axisTick: {
					show: false
				},
				detail: {
					show: false
				},
				pointer: {
					show: false
				}

			},

			{
				name: '第3个圈',
				type: 'gauge',
				radius: '65%',
				splitNumber: '5',
				center: ['50%', '50%'],
				startAngle: 220,
				endAngle: -40,
				axisLine: {
					lineStyle: {
						color: [
							[1, '#0095ff']
						],
						width: 6
					}
				},
				splitLine: {
					length: 6,
					lineStyle: {
						color: "#1D2228",
						width: 1
					}
				},
				axisLabel: {
					show: false
				},
				axisTick: {
					show: false
				},
				detail: {
					show: false
				},
				pointer: {
					show: true,
					width: 4,
				},
				data: data,
				detail: { //仪表盘详情
					formatter: '{value}' + unit,
					color: '#BBBBBB',
					fontSize: 16,
					fontWeight: 'bold',
					fontFamily: 'FZLTHJW--GB1-0',
					//相对于仪表盘中心的偏移位置，数组第一项是水平方向的偏移，第二项是垂直方向的偏移
					offsetCenter: [0, '85%']
				},


			},


			{
				name: '中间渐变色',
				type: 'gauge',
				background: "#000",
				radius: '55%',
				center: ['50%', '50%'],
				startAngle: 220,
				endAngle: -40,
				splitNumber: '10',
				axisLine: {
					lineStyle: {
						width: 13,
						color: [
							[1, '#189BFE']
						]
					}
				},
				splitLine: {
					length: 13,
					lineStyle: {
						color: "#1D2228",
						width: 1
					}
				},
				axisLabel: {
					show: false
				},
				axisTick: {
					show: false
				},
				detail: {
					show: false
				},
				pointer: {
					show: false
				},
				animation: true,

			},


			{
				name: '第四根线',
				type: 'gauge',
				background: "#000",
				radius: '35%',
				center: ['50%', '50%'],
				startAngle: 220,
				endAngle: -40,
				splitNumber: '10',
				axisLine: {
					lineStyle: {
						width: 3,
						color: [
							[1, '#189BFE']
						]
					}
				},
				splitLine: {
					length: 3,
					lineStyle: {
						color: "#1D2228",
						width: 1
					}
				},
				axisLabel: {
					show: false
				},
				axisTick: {
					show: false
				},
				detail: {
					show: false
				},
				pointer: {
					show: false
				}

			},


			{
				name: "背景颜色",
				type: 'pie',
				radius: '95%',
				center: ['50%', '50%'],
				hoverAnimation: false,
				axisLine: { // 坐标轴线
					show: false
				},
				data: [{
					value: 3,
					name: '',
					itemStyle: {
						color: "rgba(0,0,0, 0.15)"
					}
				}],
				tooltip: {
					show: false
				},
				animation: false,


				labelLine: {
					normal: {
						show: false
					}
				}

			}


		]
	};

	var num1 = 0,
		num2 = 0;
	num1 = data[0].value / 100;
	console.log(num1);


	var gra = new echarts.graphic.LinearGradient(1, 0, 0,0, [{
			offset: 0,
			color: "#345f87",
		},
		{
			offset: 1,


			color: "#132B49",

		}
	])

	var gra2 = new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
			offset: 0,
			color: "#179BFE"
		},
		{
			offset: 1,
			color: "#1c3248",
		}
	])

	var graGray = new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0,
			color: "#585b62",
		},
		{
			offset: 1,

			color: "#27282c"
		}
	])

	option.series[2].axisLine.lineStyle.color = [
		[num1, gra2],
		[1, "#A0A8AB"]
	];
	option.series[3].axisLine.lineStyle.color = [
		[num1, gra],
		[1, graGray]
	];

	option.series[4].axisLine.lineStyle.color = [
		[num1, '#179BFE'],
		[1, '#179BFE']
	];
	// option.series[5].axisLine.lineStyle.color = [[num2, '#fcff00'], [1, '#626317']];



	chart.setOption(option);



}
